package com.ama.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@Controller
public class ExitController {
    @RequestMapping("/exit")
    public String exit(HttpServletRequest request, HttpServletResponse response){
        HttpSession session = request.getSession();
        String type = request.getParameter("type");
        if("个人".equals(type)){
            session.removeAttribute("person");
        }
        if("公司".equals(type)){
            session.removeAttribute("company");
        }
        return "redirect:login";
    }

    @RequestMapping("/login")
    public String ActionLogin(){
        return "login";
    }
}
